package street;


import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		try {
			
			Scanner scanner = new Scanner(System.in);
			IpStreet ip = IpStreet.getInstance();
			while (true){
				System.out.print("请输入ip: ");
				String inputString = scanner.nextLine();

				String str = ip.get(inputString);

				String[] split = str.split("\\|",-1);
				if (split.length < 14){
					return;
				}
				Test test = new Test(split[0],split[1],split[2],split[3],split[4],
						split[5],split[6],split[7],split[8],split[9],split[10],split[11]
						,split[12],split[13],split[14],split[15],split[16],split[17],split[18],split[19],split[20],split[21],split[22]);
				System.out.println(test);
				System.out.printf("国家 %s\n",test.country);
				System.out.printf("省份 %s\n",test.province);
				System.out.printf("城市 %s\n",test.city);
				System.out.printf("区县 %s\n",test.district);
				System.out.printf("街道 %s\n",test.street);
				System.out.printf("运营商 %s\n",test.isp);
				System.out.printf("场景 %s\n",test.getScenes(test.scene));
			}


		} catch (Exception e) {
			e.printStackTrace();
		}
	}


	private String continent;// 洲
	private String country;// 国家/地区
	private String province;// 省份
	private String city;// 城市
	private String district;// 区县
	private String isp;// 运营商
	private String areaCode;// 区域代码
	private String countryEnglish;// 国家/地区英文
	private String countryEnglishShort;// 国家/地区英文简写
	private String longitude;// 经度
	private String latitude; // 纬度
	private String elevation; // 海拔
	private String zipCode; // 邮编
	private String cityCode; // 城市代码
	private String weatherStation; // 气象站
	private String asn;
	private String scene;// 场景
	private String street;// 街道
	private String time;// 时区

	private String company;// 企业

	private String useUser;// 使用人

	private String useType;// 使用类型

	private String dataType; //1 算法定位 2 实地采集

	public String getScenes(String scenes){
		String scenesCn = "";
		switch (scenes){
			case "COM":
				scenesCn = "商业公司";
				break;
			case "EDU":
				scenesCn = "教育机构";
				break;
			case "GTW":
				scenesCn = "企业专线";
				break;
			case "GOV":
				scenesCn = "政府机构";
				break;
			case "IXP":
				scenesCn = "交换中心";
				break;
			case "NET":
				scenesCn = "基础设施";
				break;
			case "ORG":
				scenesCn = "组织机构";
				break;
			case "SAT":
				scenesCn = "卫星通信";
				break;
			case "DDT":
				scenesCn = "专用出口";
				break;
			case "IDC/CDN":
				scenesCn = "数据中心/内容分发";
				break;
			case "IDC/ANY":
				scenesCn = "数据中心/任播网络";
				break;
			case "AUR":
				scenesCn = "已分配-未路由";
				break;
			case "RNU":
				scenesCn = "已路由-未使用";
				break;
			case "UND":
				scenesCn = "未分配";
				break;
			case "WLA":
				scenesCn = "WLAN热点";
				break;
			case "DYN":
				scenesCn = "家庭宽带";
				break;
			case "IDC":
				scenesCn = "数据中心";
				break;
			case "MOB":
				scenesCn = "移动网络";
				break;
			default:
				scenesCn = "-";
		}
		return scenesCn;
	}

	public Test(String continent, String country, String province, String city, String district, String isp, String areaCode, String countryEnglish, String countryEnglishShort, String longitude, String latitude, String elevation, String zipCode, String cityCode, String weatherStation, String asn, String scene, String street, String time, String company, String useUser, String useType, String dataType) {
		this.continent = continent;
		this.country = country;
		this.province = province;
		this.city = city;
		this.district = district;
		this.isp = isp;
		this.areaCode = areaCode;
		this.countryEnglish = countryEnglish;
		this.countryEnglishShort = countryEnglishShort;
		this.longitude = longitude;
		this.latitude = latitude;
		this.elevation = elevation;
		this.zipCode = zipCode;
		this.cityCode = cityCode;
		this.weatherStation = weatherStation;
		this.asn = asn;
		this.scene = scene;
		this.street = street;
		this.time = time;
		this.company = company;
		this.useUser = useUser;
		this.useType = useType;
		this.dataType = dataType;
	}

	@Override
	public String toString() {
		return "Test{" +
				"continent='" + continent + '\'' +
				", country='" + country + '\'' +
				", province='" + province + '\'' +
				", city='" + city + '\'' +
				", district='" + district + '\'' +
				", isp='" + isp + '\'' +
				", areaCode='" + areaCode + '\'' +
				", countryEnglish='" + countryEnglish + '\'' +
				", countryEnglishShort='" + countryEnglishShort + '\'' +
				", longitude='" + longitude + '\'' +
				", latitude='" + latitude + '\'' +
				", elevation='" + elevation + '\'' +
				", zipCode='" + zipCode + '\'' +
				", cityCode='" + cityCode + '\'' +
				", weatherStation='" + weatherStation + '\'' +
				", asn='" + asn + '\'' +
				", scene='" + scene + '\'' +
				", street='" + street + '\'' +
				", time='" + time + '\'' +
				", company='" + company + '\'' +
				", useUser='" + useUser + '\'' +
				", useType='" + useType + '\'' +
				", dataType='" + dataType + '\'' +
				'}';
	}

	public String getContinent() {
		return continent;
	}

	public void setContinent(String continent) {
		this.continent = continent;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getDistrict() {
		return district;
	}

	public void setDistrict(String district) {
		this.district = district;
	}

	public String getIsp() {
		return isp;
	}

	public void setIsp(String isp) {
		this.isp = isp;
	}

	public String getAreaCode() {
		return areaCode;
	}

	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}

	public String getCountryEnglish() {
		return countryEnglish;
	}

	public void setCountryEnglish(String countryEnglish) {
		this.countryEnglish = countryEnglish;
	}

	public String getCountryEnglishShort() {
		return countryEnglishShort;
	}

	public void setCountryEnglishShort(String countryEnglishShort) {
		this.countryEnglishShort = countryEnglishShort;
	}

	public String getLongitude() {
		return longitude;
	}

	public void setLongitude(String longitude) {
		this.longitude = longitude;
	}

	public String getLatitude() {
		return latitude;
	}

	public void setLatitude(String latitude) {
		this.latitude = latitude;
	}

	public String getElevation() {
		return elevation;
	}

	public void setElevation(String elevation) {
		this.elevation = elevation;
	}

	public String getZipCode() {
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	public String getCityCode() {
		return cityCode;
	}

	public void setCityCode(String cityCode) {
		this.cityCode = cityCode;
	}

	public String getWeatherStation() {
		return weatherStation;
	}

	public void setWeatherStation(String weatherStation) {
		this.weatherStation = weatherStation;
	}

	public String getAsn() {
		return asn;
	}

	public void setAsn(String asn) {
		this.asn = asn;
	}

	public String getScene() {
		return scene;
	}

	public void setScene(String scene) {
		this.scene = scene;
	}

	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public String getTime() {
		return time;
	}

	public void setTime(String time) {
		this.time = time;
	}

	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public String getUseUser() {
		return useUser;
	}

	public void setUseUser(String useUser) {
		this.useUser = useUser;
	}

	public String getUseType() {
		return useType;
	}

	public void setUseType(String useType) {
		this.useType = useType;
	}

	public String getDataType() {
		return dataType;
	}

	public void setDataType(String dataType) {
		this.dataType = dataType;
	}
}
